<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <!-- 导入依赖 -->
    <script src='https://unpkg.com/@antv/l7'></script>
    <script src="https://lib.baomitu.com/jquery/2.2.4/jquery.js"></script>
    <style>
        * {
            margin: 0;
            padding: 0
        }

        #map {
            position: absolute;
            top: 0;
            right: 0;
            bottom: 0;
            left: 0;
            background-color: rgba(255, 0, 0, 0.565);
        }
    </style>
</head>

<body>
    <div id="map">

    </div>
    <script>
        /* Scene场景 -L7不提供地图,只专注于地理数据可视化
        Scene 
        1、Map
        2、Layer
         */
        const scene = new L7.Scene({
            /* 设置场景的挂载点 */
            id: "map",
            map: new L7.GaodeMap({
                style: "dark",
                center: [114.30, 30.50],
                // pitch: 60,
                /* zoom可以实现放大和缩小级别 */
                zoom: 8
            }),
            logoVisible: false
        })

        const data = {
            type: "FeatureCollection",
            features: [
                {
                    type: "Feature",
                    geometry: {
                        type: "Point",
                        coordinates: [
                            114.30,
                            30.50
                        ]
                    },
                    properties: {
                        name: "武汉市",
                        height: 400
                    }
                },
                {
                    type: "Feature",
                    geometry: {
                        type: "Point",
                        coordinates: [
                            117.30,
                            30.50
                        ]
                    },
                    properties: {
                        name: "武汉市",
                        height: 200
                    }
                }
            ]
        }
        scene.on("loaded", () => {
            /* 
            1、PolygonLayer
            2、LineLayer
             */
            let point_layer = new L7.PointLayer();
            point_layer.source(data)
                /* size可以获取properties中的值,可以对值进行处理 */
                .size("height", h => {
                    console.log(h);
                    return h / 8;
                })
                /* shape设置形状 */
                .shape("circle")
                .color("#ff2d51")
            scene.addLayer(point_layer)
        })
    </script>
</body>

</html>